/*
 * Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
 */

package com.xci.xajtfb.bus.dao;

import com.github.lvyanyang.annotation.Paging;
import com.xci.xajtfb.bus.entity.LineInfo;
import com.xci.xajtfb.bus.entity.TbBusLine;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * 公交线路数据层
 * @author 吕艳阳 lvyanyang@xci96716.com
 * @since 2021-02-05 17:30:26
 */
public interface TbBusLineDao {
    /**
     * 根据主键查询单个
     * @param id 主键
     * @return 返回实体
     */
    Map<String, Object> selectById(@Param("id") Long id);

    /**
     * 根据名称查询（模糊）
     * @param name 名称
     * @return 返回实体
     */
    List<Map<String, Object>> selectByName(@Param("name") String name);

    /**
     * 根据线路Id查询
     * @param routeId 线路主键
     * @return 返回实体
     */
    TbBusLine selectByRouteId(@Param("routeId") String routeId);

    /**
     * 根据线路Id，上下行查询首末班时间及票价
     * @param routeId
     * @return
     */
    Map<String,Object> getSegmentInfo(@Param("routeId") String routeId);

    /**
     * 根据线路Id，上下行查询首末班时间及票价
     * @param routeId
     * @return
     */
    Map<String,Object> getSegmentInfoByType(@Param("routeId") String routeId,
                                            @Param("type") String Type);


    /**
     * 根据线路Id查询
     * @param routeId 线路主键
     * @return 返回实体
     */
    LineInfo selectLineInfoByRouteId(@Param("routeId") String routeId);

    /**
     * 查询列表
     * @return 返回线路列表
     */
    List<TbBusLine> selectList();

    /**
     * 查询分页列表
     * @param filter 过滤条件
     * @return 返回分页列表
     */
    /*
        allowSortNames = {"lineid","lineserial","companyid","length","busnumber","stationfrom","stationto","firsttime","lasttime","firsttimed","lasttimed","operatingtype","managefrom","manageto","peaceinterval","highinterval","stationnumber","stationnumberd","ticketsystem","ticketprice","isaircondition","isswipe","isextension","isgps","opentime","onetime","direction","mapname","mapaddress","pricename","priceurl","remarks","deleted","isvalid","operateperson","operatetype","operatedate","reserve1","reserve2","reserve3","comparelineid","comparelineserial","issynset","issynsettime"},
        sortNameMaps = {"lineid:lineid","lineserial:lineserial","companyid:companyid","length:length","busnumber:busnumber","stationfrom:stationfrom","stationto:stationto","firsttime:firsttime","lasttime:lasttime","firsttimed:firsttimed","lasttimed:lasttimed","operatingtype:operatingtype","managefrom:managefrom","manageto:manageto","peaceinterval:peaceinterval","highinterval:highinterval","stationnumber:stationnumber","stationnumberd:stationnumberd","ticketsystem:ticketsystem","ticketprice:ticketprice","isaircondition:isaircondition","isswipe:isswipe","isextension:isextension","isgps:isgps","opentime:opentime","onetime:onetime","direction:direction","mapname:mapname","mapaddress:mapaddress","pricename:pricename","priceurl:priceurl","remarks:remarks","deleted:deleted","isvalid:isvalid","operateperson:operateperson","operatetype:operatetype","operatedate:operatedate","reserve1:reserve1","reserve2:reserve2","reserve3:reserve3","comparelineid:comparelineid","comparelineserial:comparelineserial","issynset:issynset","issynsettime:issynsettime"}
    */
    @Paging
    List<Map<String, Object>> selectPageList(@Param("filter") Map<String,Object> filter);
}